/*
 * @Author: EvanXU evanxu8023@163.com
 * @Date: 2023-08-29 10:45:44
 * @LastEditors: EvanXU evanxu8023@163.com
 * @LastEditTime: 2024-08-08 14:01:28
 * @FilePath: \program\APP\dev_uart.h
 * @Description: 
 *  xxx 
 * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved. 
 */
/**
 * @file dev_uart.h
 * @author lik
 * @brief uart相关配置函数
 * @version 0.1
 * @date 2022-01-14
 * 
 * @copyright Copyright (c) 2022
 * 
 */

#ifndef __DEV_UART_H__
#define __DEV_UART_H__

#include "sys.h"


#define PRINT_UART                       USART1
#define PRINT_UART_CRM_CLK               CRM_USART1_PERIPH_CLOCK
#define PRINT_UART_TX_PIN                GPIO_PINS_9
#define PRINT_UART_TX_GPIO               GPIOA
#define PRINT_UART_TX_GPIO_CRM_CLK       CRM_GPIOA_PERIPH_CLOCK
#define PRINT_UART_RX_PIN                GPIO_PINS_10
#define PRINT_UART_RX_GPIO               GPIOA
#define PRINT_UART_RX_GPIO_CRM_CLK       CRM_GPIOA_PERIPH_CLOCK



#define USART1_SEND_LEN  			64
extern uint8_t usart1_tx_buf[USART1_SEND_LEN];
#define USART1_REC_LEN  			128
extern uint8_t usart1_rx_buf[USART1_REC_LEN];
extern uint16_t usart1_rx_sta;

void usart1_send_string(char *str);

#define USART3_REC_LEN  			32
extern uint8_t usart3_rx_buf[USART3_REC_LEN];
extern uint16_t usart3_rx_sta;


void usart2_init(uint32_t baudrate);
void usart2_send_byte(uint8_t byte);
void usart2_send_buffer(uint8_t *Buffer, uint32_t Length);

void usart3_init(uint32_t baud);
void usart3_send_byte(uint8_t byte);
void usart3_send_buffer(uint8_t *Buffer, uint32_t Length);

#endif //__DEV_UART_H__


